package com.winfield.service;

import android.util.Log;

/**
 * 该类是http头的字典 根据文件的后缀名返回不同的 ContentType
 * @author Winfield
 *
 */
public class ContentTypeDictionary {
/**
 *根据文件名的后缀名  来返回他的 ContentType
 * @param filename
 * @return
 */
	public static String getType(String filename) {
		//此处也可以用switch来实现
		if(filename.endsWith("jpg")||filename.endsWith("JPG")
				||filename.endsWith("jpeg")||filename.endsWith("JPEG")){
			Log.e("wFileName", filename);
			return "image/jpeg";
		}else if(filename.endsWith("3gp")||filename.endsWith("3GP")){
			Log.e("wFileName", filename);
			return "video/3gpp";
		}
		/*
		else if(filename.endsWith("png")||filename.endsWith("PNG")){
			Log.e("wFileName", filename);
			return "image/png";
		}else if(filename.endsWith("gif")||filename.endsWith("GIF")){
			Log.e("wFileName", filename);
			return "image/gif";
		}else if(filename.endsWith("avi")||filename.endsWith("AVI")){
			Log.e("wFileName", filename);
			return " video/avi";
		}else if(filename.endsWith("mp4")||filename.endsWith("MP4")){
			Log.e("wFileName", filename);
			return "video/mp4";
		}*/
		
		
		return null;
	}

}
